package Workflow;

import java.util.concurrent.BlockingQueue;

import Model.Candidate;
import Model.Report;

public class PTest implements Runnable{

	BlockingQueue<Candidate> inQueue;
	BlockingQueue<Report> outQueue;
	private Candidate candidate;
	
	public PTest (BlockingQueue<Candidate> inQ, BlockingQueue<Report> outQ){
		inQueue = inQ;
		outQueue = outQ;
		/*
		 * TODO SWING ablak
		 */
	}
	
	public void addReport(Report r){
		try {
			outQueue.put(r);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public void getCandidate(){
		try {
			candidate = inQueue.take();
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	private void Test(){
		getCandidate();
		if (candidate.degree) {
			candidate.report.professional = true;
		}
		else {
			candidate.report.professional = false;
		}
		candidate.report.pr_tested = true;
		addReport(candidate.report);
	}
	
	@Override
	public void run() {
		while (true){
			Test();
			System.out.println("Test()" + inQueue.size());
		}
		
	}

}
